﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace DFGK_WMS.Model.Models
{
    /// <summary>
    /// 入库单明细
    /// </summary>
    [Table("T_ReceivingOrderDetail")]
    public class ReceivingOrderDetail:BaseEntity
    {
        /// <summary>
        /// 入库单编号
        /// </summary>
        [MaxLength(60)]
        public string OrderSn { get; set; }

        /// <summary>
        /// 单据类型 
        /// </summary>
        public int? BillType { get; set; }
        /// <summary>
        /// 库房编码
        /// </summary>
        [MaxLength(60)]
        public string WarehouseCode { get; set; }
        /// <summary>
        /// 库房名称
        /// </summary>
        [MaxLength(60)]
        public string WarehouseName { get; set; }
        /// <summary>
        /// 库区编码
        /// </summary>
        [MaxLength(60)]
        public string AreaCode { get; set; }
        /// <summary>
        /// 库区名称
        /// </summary>
        [MaxLength(60)]
        public string AreaName { get; set; }
        /// <summary>
        /// 物料Id
        /// </summary>
        public long? MaterialId { get; set; }
        /// <summary>
        /// 物料号
        /// </summary>
        [MaxLength(60)]
        public string MaterialCode { get; set; }
        /// <summary>
        /// 物料名称
        /// </summary>
        [MaxLength(60)]
        public string MaterialName { get; set; }
        /// <summary>
        /// 物料类型编码
        /// </summary>
        [MaxLength(60)]
        public string MaterialTypeCode { get; set; }

        /// <summary>
        /// 物料条码（69码）
        /// </summary>
        [MaxLength(60)]
        public string Articlebarcode { get; set; }

        /// <summary>
        /// 物料类型
        /// </summary>
        [MaxLength(60)]
        public string MaterialTypeName { get; set; }
        /// <summary>
        /// 实际接收数量：为基本单位的数量
        /// </summary>
        [Column(TypeName = "decimal(18,4)")]
        public decimal? ReceivedQty { get; set; }
        /// <summary>
        /// 期待数量：即订单数量，为基本单位的数量(基本单位入库数量)
        /// </summary>
        [Column(TypeName = "decimal(18,4)")]
        public decimal? Qty { get; set; }
        /// <summary>
        /// 码垛完成的数量
        /// </summary>
        [Column(TypeName = "decimal(18,4)")]
        public decimal? StackedQty { get; set; }
        /// <summary>
        /// 包装完成的数量
        /// </summary>
        [Column(TypeName = "decimal(18,4)")]
        public decimal? PackagedQty { get; set; }
        /// <summary>
        /// 总包装数量
        /// </summary>
        public int? PackQty { get; set; }
        /// <summary>
        /// 物料基本单位Id
        /// </summary>
        public long? UnitId { get; set; }
        /// <summary>
        /// 物料基本单位
        /// </summary>
        public string UnitName { get; set; }
        /// <summary>
        /// ERP物料号
        /// </summary>
        [MaxLength(60)]
        public string Erpcode { get; set; }
        /// <summary>
        /// 批次号
        /// </summary>
        [MaxLength(60)]
        public string BatchNo { get; set; }     

        /// <summary>
        /// 仓位Id
        /// </summary>
        public long? LocationId { get; set; }

        /// <summary>
        /// 仓位名称
        /// </summary>
        [MaxLength(60)]
        public string LocationName { get; set; }

        /// <summary>
        /// 仓位编码
        /// </summary>
        [MaxLength(60)]
        public string LocationCode { get; set; }

        /// <summary>
        /// 垛条码
        /// </summary>
        [MaxLength(60)]
        public string PalletBarcode { get; set; }

        /// <summary>
        /// 有效期
        /// </summary>
        public DateTime? ExpireDate { get; set; }
        /// <summary>
        /// 质检日期
        /// </summary>
        public DateTime? Qadate { get; set; }
        /// <summary>
        /// 生产日期
        /// </summary>
        public DateTime? ProductDate { get; set; }
        /// <summary>
        /// 生产厂家
        /// </summary>
        public string ProduceFactory { get; set; }
        /// <summary>
        /// 供应商Id
        /// </summary>
        public long? SupplierId { get; set; }
        /// <summary>
        /// 供应商
        /// </summary>
        [MaxLength(60)]
        public string SupplierName { get; set; }

        /// <summary>
        /// 客户id
        /// </summary>
        public long? CustomerId { get; set; }

        /// <summary>
        /// 客户名称
        /// </summary>
        [MaxLength(60)]
        public string CustomerName { get; set; }

        /// <summary>
        /// 出厂日期
        /// </summary>
        public DateTime? OutFactoryDate { get; set; }
    
        /// <summary>
        /// 最早入库时间
        /// </summary>
        public DateTime? InStarDate { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        
        /// <summary>
        /// 物料Key
        /// </summary>
        public long? MaterialKeyId { get; set; }
        /// <summary>
        /// 质量状态：0-待检；1-合格；2-不合格；
        /// </summary>
        public int QualityState { get; set; }
        /// <summary>
        /// 状态：0-新建;1-已启动;2-作业中;3-已完成;4-强制完成;5-暂停;6-失效；7-异常
        /// </summary>
        public int Status { get; set; } = 0;
        [MaxLength(100)]
        public string MaterialImg { get; set; }
        /// <summary>
        /// 逻辑分区编码
        /// </summary>
        [MaxLength(60)]
        public string LogicalPartCode { get; set; }
        /// <summary>
        /// 逻辑分区名称
        /// </summary>
        [MaxLength(60)]
        public string LogicalPartName { get; set; }
        /// <summary>
        /// 物料凭证号
        /// </summary>
        [MaxLength(60)]
        public string Mblnr { get; set; }
        /// <summary>
        /// 部门编码
        /// </summary>
        [MaxLength(60)]
        public string DeptCode { get; set; }
        /// <summary>
        /// 部门名称
        /// </summary>
        [MaxLength(60)]
        public string DeptName { get; set; }
        /// <summary>
        /// 合同号
        /// </summary>
        [MaxLength(60)]
        public string ContractNo { get; set; }
        /// <summary>
        /// 单据来源类型：0-手动建单；1-ERP;2-MES;3-SAP;4-出库没出完的托盘二次入库的
        /// </summary>
        public int? SourceType { get; set; }
       
        /// <summary>
        /// 提交时间
        /// </summary>
        public DateTime? SubmitDate { get; set; }
        /// <summary>
        /// 提交人Id
        /// </summary>
        public int? SubmitUserId { get; set; }
        /// <summary>
        /// 提交人
        /// </summary>
        public string SubmitUserName { get; set; }
        /// <summary>
        /// 审核人Id
        /// </summary>
        public int? AuditUserId { get; set; }
        /// <summary>
        /// 审核人
        /// </summary>
        public string AuditUserName { get; set; }
        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime? AuditDate { get; set; }
        /// <summary>
        /// 物料凭证年度
        /// </summary>
        [MaxLength(60)]
        public string Mjahr { get; set; }
        /// <summary>
        /// 物料凭证行项目
        /// </summary>
        [MaxLength(60)]
        public string Zeile { get; set; }
        /// <summary>
        /// 采购订单号
        /// </summary>
        [MaxLength(60)]
        public string PurOrderNo { get; set; }
        /// <summary>
        /// 采购订单行号
        /// </summary>
        [MaxLength(60)]
        public string PurOrderLineNo { get; set; }
        /// <summary>
        /// 采购订单行项目类型：0-无；1-L外协；2-U转储;3-正常采购
        /// </summary>
        public int? PurOrderLineType { get; set; }
        /// <summary>
        /// 生产订单号
        /// </summary>
        [MaxLength(60)]
        public string ProOrderNo { get; set; }
        /// <summary>
        /// 外协需求跟踪号
        /// </summary>
        [MaxLength(60)]
        public string OutOrderNo { get; set; }

        public int? RefInVoucherId { get; set; }

        /// <summary>
        /// 仓库Id
        /// </summary>
        public long? WarehouseId { get; set; }

        /// <summary>
        /// 收货明细Id
        /// </summary>
        public long? ReceivingBillDetailId { get; set; }

        /// <summary>
        /// 收货明细Id
        /// </summary>
        public long? ReceivingBillId { get; set; }

        /// <summary>
        /// 总计
        /// </summary>
        [Column(TypeName = "decimal(18,4)")]
        public decimal? TotalPrice { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        [Column(TypeName = "decimal(18,4)")]
        public decimal? Price { get; set; }

        /// <summary>
        /// 批次号说明
        /// </summary>
        public string BatchNoExplain { get; set; }
    }
}
